home *** CD-ROM | disk | FTP | other *** search
/ CD Classic 39 / CD CLASSIC #39 (1998).iso / EMPRESA / visio / Vistdstd / Install / Data.Z / Orgchart.FRM (.txt) < prev    next >
Visual Basic Form  |  1996-09-05  |  11KB  |  315 lines

  1. VERSION 4.00
  2. Begin VB.Form frmOrgChart 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Visio Organizational Chart"
  6.    ClientHeight    =   5430
  7.    ClientLeft      =   705
  8.    ClientTop       =   2040
  9.    ClientWidth     =   6270
  10.    FillColor       =   &H00808080&
  11.    FillStyle       =   0  'Solid
  12.    BeginProperty Font 
  13.       name            =   "MS Sans Serif"
  14.       charset         =   0
  15.       weight          =   700
  16.       size            =   8.25
  17.       underline       =   0   'False
  18.       italic          =   0   'False
  19.       strikethrough   =   0   'False
  20.    EndProperty
  21.    ForeColor       =   &H00808080&
  22.    Height          =   6120
  23.    Icon            =   "ORGCHART.frx":0000
  24.    KeyPreview      =   -1  'True
  25.    Left            =   645
  26.    LinkTopic       =   "Form1"
  27.    ScaleHeight     =   5430
  28.    ScaleWidth      =   6270
  29.    Top             =   1410
  30.    Width           =   6390
  31.    Begin VB.Frame Frame1 
  32.       Appearance      =   0  'Flat
  33.       BackColor       =   &H00C0C0C0&
  34.       Caption         =   "Organization Chart"
  35.       ForeColor       =   &H00000000&
  36.       Height          =   4455
  37.       Left            =   120
  38.       TabIndex        =   3
  39.       Top             =   840
  40.       Width           =   6015
  41.       Begin MSOutl.Outline Outline1 
  42.          Height          =   3975
  43.          Left            =   120
  44.          TabIndex        =   2
  45.          TabStop         =   0   'False
  46.          Top             =   360
  47.          Width           =   5775
  48.          _Version        =   65536
  49.          _ExtentX        =   10186
  50.          _ExtentY        =   7011
  51.          _StockProps     =   77
  52.          ForeColor       =   -2147483640
  53.          BackColor       =   -2147483643
  54.          Style           =   4
  55.          PicturePlus     =   "ORGCHART.frx":030A
  56.          PictureMinus    =   "ORGCHART.frx":0404
  57.          PictureLeaf     =   "ORGCHART.frx":04FE
  58.          PictureOpen     =   "ORGCHART.frx":05F8
  59.          PictureClosed   =   "ORGCHART.frx":06F2
  60.       End
  61.    End
  62.    Begin VB.TextBox Text1 
  63.       Appearance      =   0  'Flat
  64.       BackColor       =   &H00FFFFFF&
  65.       BeginProperty Font 
  66.          name            =   "MS Sans Serif"
  67.          charset         =   0
  68.          weight          =   700
  69.          size            =   9.75
  70.          underline       =   0   'False
  71.          italic          =   0   'False
  72.          strikethrough   =   0   'False
  73.       EndProperty
  74.       Height          =   360
  75.       Left            =   120
  76.       TabIndex        =   0
  77.       TabStop         =   0   'False
  78.       Text            =   "Text1"
  79.       Top             =   360
  80.       Width           =   6015
  81.    End
  82.    Begin VB.Label Label1 
  83.       Appearance      =   0  'Flat
  84.       BackColor       =   &H00C0C0C0&
  85.       Caption         =   "Name:"
  86.       ForeColor       =   &H80000008&
  87.       Height          =   255
  88.       Left            =   120
  89.       TabIndex        =   1
  90.       Top             =   120
  91.       Width           =   6015
  92.    End
  93.    Begin VB.Menu mnuChart 
  94.       Caption         =   "&Chart"
  95.       Begin VB.Menu mnuChartItem 
  96.          Caption         =   "Show &All Items"
  97.          Checked         =   -1  'True
  98.          Index           =   0
  99.          Shortcut        =   ^A
  100.       End
  101.       Begin VB.Menu mnuChartItem 
  102.          Caption         =   "&Create Chart"
  103.          Index           =   1
  104.       End
  105.       Begin VB.Menu mnuChartItem 
  106.          Caption         =   "Read Chart From &Visio"
  107.          Index           =   2
  108.       End
  109.    End
  110.    Begin VB.Menu mnuCommand 
  111.       Caption         =   "C&ommands"
  112.       Begin VB.Menu mnuCommandItem 
  113.          Caption         =   "&Promote"
  114.          Index           =   0
  115.       End
  116.       Begin VB.Menu mnuCommandItem 
  117.          Caption         =   "&Demote"
  118.          Index           =   1
  119.       End
  120.       Begin VB.Menu mnuCommandItem 
  121.          Caption         =   "De&lete"
  122.          Index           =   2
  123.       End
  124.       Begin VB.Menu mnuCommandItem 
  125.          Caption         =   "Delete B&ranch"
  126.          Index           =   3
  127.       End
  128.    End
  129. Attribute VB_Name = "frmOrgChart"
  130. Attribute VB_Creatable = False
  131. Attribute VB_Exposed = False
  132. '------------------------------------------------------------------------------
  133. '------------------------------------------------------------------------------
  134. '--                       Visio Organization Chart AddOn
  135. '--                       (C)1993 Shapeware Corporation
  136. '--   File Name : OrgChart.frm
  137. '-- Description : Main form for the OrgChart AddOn
  138. '-- Audit Trail:
  139. '-- 09/15/93 - v3.000 - aw -    Moved code into the module orchart.bas.
  140. '--                             Started on keyboard equiv, but needs more work!
  141. '--                             Idea was to make a global keyboard handler which
  142. '--                             explains why form.Keypreview = False etc.
  143. '--                             Reorganized the menus according to the code that
  144. '--                             I moved to the module.
  145. '-- 07/**/93 - v2.000 - bl -    Added option read orgchart in menu chart.
  146. '-- **/**/** - v1.000 - ** -    Created.
  147. '------------------------------------------------------------------------------
  148. '------------------------------------------------------------------------------
  149. Option Explicit
  150. Private Declare Function GetKeyState Lib "User" (ByVal nVirtKey As Integer) As Integer
  151. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  152.     Dim temp As Integer, ind As Integer
  153.     Select Case KeyCode
  154.         Case KEY_TAB:
  155.             If (Shift And SHIFT_MASK) > 0 Then
  156.                 PromoteItem
  157.             Else
  158.                 DemoteItem
  159.             End If
  160.             Text1.SetFocus
  161.         Case KEY_DOWN
  162.             If (Shift And CTRL_MASK) > 0 Then
  163.                 movedown
  164.                 UpdateFields
  165.             ElseIf Outline1.ListIndex < (Outline1.ListCount - 1) Then
  166.                 Outline1.ListIndex = Outline1.ListIndex + 1
  167.                 UpdateFields
  168.             Else
  169.                 Beep
  170.             End If
  171.         Case KEY_BACK
  172.             If Text1.Text = "" Then
  173.                 temp = Outline1.ListIndex
  174.                 mnuCommandItem_click DeleteBranch
  175.                 If Outline1.ListCount > 0 Then Outline1.ListIndex = temp - 1
  176.                 UpdateFields
  177.             Else
  178.                 If Outline1.ListIndex <> -1 Then
  179.                     Outline1.List(Outline1.ListIndex) = Text1.Text
  180.                     Outline1.Refresh
  181.                     SuperExpand (Outline1.ListIndex)
  182.                 Else
  183.                     Beep
  184.                 End If
  185.             End If
  186.         Case KEY_RETURN
  187.             ind = Outline1.ListIndex
  188.             If Outline1.ListIndex <> -1 Then
  189.                 If Outline1.List(ind) <> "" Then
  190.                     Outline1.AddItem ""
  191.                     Outline1.ListIndex = Outline1.ListIndex + 1
  192.                     If Outline1.Indent(Outline1.ListIndex) > 1 Then
  193.                         Outline1.Indent(Outline1.ListIndex) = Outline1.Indent(Outline1.ListIndex - 1)
  194.                     End If
  195.                 Else
  196.                     Beep
  197.                 End If
  198.             Else
  199.                 Beep
  200.                 Outline1.AddItem ""
  201.                 Outline1.Indent(0) = 0
  202.                 Outline1.ListIndex = Outline1.ListCount - 1
  203.             End If
  204.             UpdateFields
  205.             Outline1.Refresh
  206.             SuperExpand (Outline1.ListIndex)
  207.     End Select
  208. End Sub
  209. Private Sub Form_KeyPress(KeyAscii As Integer)
  210. '------------------------------------------------------------------------------------------------
  211. '------------------------------------------------------------------------------------------------
  212. '-- Some keystrokes causes the system to beep, avoid beep by intercepting
  213. '-- the enter key.
  214.     Select Case KeyAscii
  215.         Case KEY_RETURN:
  216.             KeyAscii = 0
  217.         Case KEY_TAB:
  218.             KeyAscii = 0
  219.     End Select
  220. End Sub
  221. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  222.     Select Case KeyCode
  223.         Case KEY_LEFT
  224.             If (Shift And CTRL_MASK) > 0 Then mnuCommandItem_click Promote
  225.         Case KEY_RIGHT
  226.             If (Shift And CTRL_MASK) > 0 Then
  227.                 If (Shift And ALT_MASK) > 0 Then
  228.                     mnuCommandItem_click DeleteBranch
  229.                 Else
  230.                     mnuCommandItem_click Demote
  231.                 End If
  232.             End If
  233.         Case KEY_UP
  234.             If (Shift And CTRL_MASK) > 0 Then
  235.                 moveup
  236.                 UpdateFields
  237.             ElseIf Outline1.ListIndex <> 0 Then
  238.                 Outline1.ListIndex = Outline1.ListIndex - 1
  239.                 UpdateFields
  240.             Else
  241.                 Beep
  242.             End If
  243.         Case Else
  244.             If Outline1.ListIndex <> -1 Then
  245.                 Outline1.List(Outline1.ListIndex) = Text1.Text
  246.                 Outline1.Refresh
  247.                 SuperExpand (Outline1.ListIndex)
  248.             Else
  249.                 Beep
  250.                 Text1.Text = ""
  251.             End If
  252.     End Select
  253. End Sub
  254. Private Sub Form_Load()
  255.     frmOrgChart.Outline1.AddItem ""
  256.     Outline1.ListIndex = 0
  257.     Outline1.Indent(Outline1.ListIndex) = 0
  258.     UpdateFields
  259. End Sub
  260. Private Sub mnuChartItem_Click(Index As Integer)
  261. '------------------------------------------------------------------------------------------------
  262. '------------------------------------------------------------------------------------------------
  263. '-- The three menu items in the menu Chart
  264.     Dim strMsg As String
  265.     Select Case Index
  266.         Case ShowItems:
  267.             If Not mnuChartItem(ShowItems).Checked Then TopExpand (0)
  268.             mnuChartItem(ShowItems).Checked = Not mnuChartItem(ShowItems).Checked
  269.         Case CreateChart:
  270.             If Outline1.ListCount > 0 Then
  271.                 CreateOrgChart
  272.             Else
  273.                 Beep
  274.             End If
  275.         Case ReadChart:
  276.             If Not (frmOrgChart.Outline1.ListCount <> 0 And frmOrgChart.Outline1.List(0) = "") Then
  277.                 strMsg = "Continuing will erase current orgchart, continue?"
  278.                 If MsgBox(strMsg, MB_YESNO, "OrgChart") = IDNO Then
  279.                     Exit Sub
  280.                 Else
  281.                     frmOrgChart.Text1.Text = ""
  282.                     frmOrgChart.Outline1.Clear
  283.                 End If
  284.             End If
  285.             ReadOrgChart
  286.     End Select
  287. End Sub
  288. Private Sub mnuCommandItem_click(Index As Integer)
  289. '-- Then four menu items in the menu Command
  290.     Select Case Index
  291.         Case Promote:
  292.             PromoteItem
  293.         Case Demote:
  294.             DemoteItem
  295.         Case Delet:
  296.             DeleteItem
  297.         Case DeleteBranch:
  298.             DeleteItemBranch
  299.     End Select
  300. End Sub
  301. Private Sub Outline1_Click()
  302.     UpdateFields
  303.     Text1.SetFocus
  304. End Sub
  305. Private Sub Outline1_Collapse(ListIndex As Integer)
  306.     If frmOrgChart.mnuChartItem(ShowItems).Checked Then
  307.         TopExpand (ListIndex)
  308.     End If
  309.     Text1.SetFocus
  310. End Sub
  311. Private Sub Outline1_DblClick()
  312.     TopExpand (Outline1.ListIndex)
  313.     Text1.SetFocus
  314. End Sub
  315.